$(function() {
	//prevent submit of form
	$('.rotatingForm').on('submit', function(e) {
		e.preventDefault();
	});

	var currentStep = 1;
	var nbOfSteps = 4;

	$('.step-btn').click(function() {

		//remember the last step that was active
		var prevStep = currentStep;

		//increment or decrase currentStep based on the btn that was clicked
		if($(this).hasClass('next-btn')) {
			//here you can validate this fieldset with ajax for example
			currentStep++;
		} else if($(this).hasClass('back-btn')) {
			currentStep--;
		}

		//reset the step to 1 if we reached 0 or nbOfSteps
		// if(currentStep > nbOfSteps || currentStep <= 0) {
		// 	currentStep = 1;
		// }

		//change the step (rotate the cube)
		$(".rotatingForm").toggleClass("show-step" + prevStep).toggleClass("show-step" + currentStep);

	});

	//floating labels
	$('input').on('focus focusout', function() {
		console.log($(this).value);
		if($(this).val() == "") {
			$(this).prev().toggleClass("focused");
		} 
	});
});